//
//  ZImageLoopView.h
//
//  Created by 周成龙
//

#import <UIKit/UIKit.h>

#import "ZLoopCell.h"

@protocol ZImageLoopViewDataSource;
@protocol ZImageLoopViewDelegate;

@interface ZImageLoopView : UIView

/**
 图片数组
 */
@property (nonatomic, strong) NSArray *imageArray;

/**
 轮播间隔: 默认是 3s
 */
@property (nonatomic)         int second;
@property (nonatomic, assign) id <ZImageLoopViewDataSource> dataSource;
@property (nonatomic, assign) id <ZImageLoopViewDelegate>   delegate;

- (instancetype)initWithFrame:(CGRect)frame withDataSource:(id<ZImageLoopViewDataSource>)dataSource withDelegate:(id<ZImageLoopViewDelegate>)delegate;
/**
 *  刷新视图
 */
- (void)reloadData;

@end

#pragma mark - ZImageLoopViewDataSource
@protocol ZImageLoopViewDataSource <NSObject>

- (NSInteger)numberOfPagesInLoopView:(ZImageLoopView *)loopView;

- (ZLoopCell *)loopView:(ZImageLoopView *)loopView cellForPageAtIndex:(NSUInteger)index;

@end

#pragma mark - ZImageLoopViewDelegate
@protocol  ZImageLoopViewDelegate <NSObject>

- (CGSize)sizeForPageInLoopView:(ZImageLoopView *)loopView;

@optional

- (void)loopView:(ZImageLoopView *)loopView didScrollToPage:(NSInteger)pageNumber;

- (void)loopView:(ZImageLoopView *)loopView didSelectPageAtIndex:(NSInteger)index;

@end
